import pytest
import os
from selenium import webdriver
import time

# 调用浏览器
@pytest.fixture(scope="function",autouse=True)
def getdriver():
    driver=webdriver.Edge()
    driver.maximize_window()
    yield driver
    time.sleep(5)
    driver.quit()


# @pytest.fixture(scope='session',autouse=True)
# def getenv():
#     print("整个项目运行前:",os.getenv('base_url'))
#     yield
#     print("整个项目运行后:",os.getenv('db_host'))

# pytest-dotenv
# from dotenv import load_dotenv
#
# def pytest_configure(config):
#     #根据命令行参数决定加载哪个环境文件
#     env_file=config.getoption("--env-file") or '.env'
#     print("路径:",env_file)
#     load_dotenv(env_file)
#
# def pytest_addoption(parser):
#     parser.addoption(
#         "--env-file",
#         action="store",
#         default=".env",
#         help="指定要加载的环境文件路径"
#     )